import config from "@/config";
import http from "@/utils/request";

/**
 * 所有接口集合
 * 每个接口对象需含有以下字段
 * @url 接口的URL地址
 * @name 接口名称
 * @get|post 返回请求接口的函数
 */

const api = {
	default: {
		upload: {
			url: `${config.MOCK_URL}/upload`,
			name: "文件上传",
			post: async function(data){

				return await http.post(this.url, data);
			}
		}
	},
	admin:{
		info:{
			url: `${config.MOCK_URL}/login/info`,
			name: "管理员信息",
			get: async function(data){
				return await http.get(this.url, data);
			}
		},
		save:{
			url: `${config.MOCK_URL}/login/edit`,
			name: "管理员信息",
			post: async function(data){
				return await http.post(this.url, data);
			}
		}
	},
	upload:{
		img:{
			url: `${config.MOCK_URL}/upload/image`,
			name: "图片上传",
			post: async function(data){
				return await http.post(this.url, data);
			}
		}
	},
	diy:{
		list:{
			url: `${config.MOCK_URL}/diy`,
			name: "s",
			get: async function(params={}){
				return await http.get(this.url, params);
			}
		},
		save:{
			url: `${config.MOCK_URL}/diy/edit`,
			name: "diy",
			post: async function(params={}){
				return await http.post(this.url, params);
			}
		},
		del:{
			url: `${config.MOCK_URL}/diy/del`,
			name: "删除店铺",
			post: async function(params={}){
				return await http.get(this.url, params);
			}
		}
	},
	video:{
		getQiniuToken:{
			url: `${config.MOCK_URL}/video/getQiniuToken`,
			name: "获取七牛云token",
			get: async function(data){
				return await http.get(this.url, data);
			}
		},
		qiniuUpload:{
			url: `https://up-z2.qiniup.com`,
			name: "上传至七牛云",
			post: async function(data){
				return await http.post(this.url, data);
			}
		},
		addVideo:{
			url: `${config.MOCK_URL}/video/addVideo`,
			name: "添加至视频库",
			post: async function(data){
				return await http.post(this.url, data);
			}
		}
	},
	store:{
		list:{
			url: `${config.MOCK_URL}/store`,
			name: "店铺列表",
			get: async function(data){
				return await http.get(this.url, data);
			}
		},
        user_seach:{
            url: `${config.MOCK_URL}/store/user_seach`,
            name: "",
            get: async function(data){
                return await http.get(this.url, data);
            }
		},
		edit:{
			url: `${config.MOCK_URL}/store/edit`,
			name: "编辑店铺",
			post: async function(params={}){
				return await http.post(this.url, params);
			}
		},
		vlist:{
			url: `${config.MOCK_URL}/store/vlist`,
			name: "店铺所属视频",
			get: async function(data){
				return await http.get(this.url, data);
			}
		},
		del: {
			url: `${config.MOCK_URL}/store/del`,
			name: "删除店铺",
			post: async function(params={}){
				return await http.get(this.url, params);
			}
		},
		shenghe:{
			url: `${config.MOCK_URL}/store/shenghe`,
			name: "店铺审核",
			post: async function(params={}){
				return await http.post(this.url, params);
			}
		},
		vshenghe:{
			url: `${config.MOCK_URL}/store/vshenghe`,
			name: "视频审核",
			post: async function(params={}){
				return await http.post(this.url, params);
			}
		},
		vdel:{
			url: `${config.MOCK_URL}/store/vdel`,
			name: "视频删除",
			post: async function(params={}){
				return await http.post(this.url, params);
			}
		},
		shangchuang:{
			url: `${config.MOCK_URL}/store/video`,
			name: "视频上传",
			post: async function(params={}){
				return await http.post(this.url, params);
			}
		},
		sptijiao:{
			url: `${config.MOCK_URL}/store/sptijiao`,
			name: "视频提交",
			post: async function(params={}){
				return await http.post(this.url, params);
			}
		},
		hdlist:{
			url: `${config.MOCK_URL}/dyactivity`,
			name: "活动列表",
			get: async function(params={}){
				return await http.get(this.url, params);
			}
		},
		hdedit:{
			url: `${config.MOCK_URL}/dyactivity/edit`,
			name: "活动添加/编辑",
			post: async function(params={}){
				return await http.post(this.url, params);
			}
		},
		hddel:{
			url: `${config.MOCK_URL}/dyactivity/del`,
			name: "活动删除",
			post: async function(params={}){
				return await http.post(this.url, params);
			}
		},
		hddata:{
			url: `${config.MOCK_URL}/dyactivity/detailed`,
			name: "活动详细",
			get: async function(params={}){
				return await http.get(this.url, params);
			}
		},
		hddatauser:{
			url: `${config.MOCK_URL}/dyactivity/scancode_user`,
			name: "活动转发用户",
			get: async function(params={}){
				return await http.get(this.url, params);
			}
		}

	},
	jiaochen:{
		list:{
			url: `${config.MOCK_URL}/course`,
			name: "教程列表",
			get: async function(data){
				return await http.get(this.url, data);
			}
		},
		save:{
			url: `${config.MOCK_URL}/course/edit`,
			name: "教程编辑",
			post: async function(data){
				return await http.post(this.url, data);
			}
		},
		del:{
			url: `${config.MOCK_URL}/course/del`,
			name: "教程删除",
			post: async function(data){
				return await http.post(this.url, data);
			}
		}
	},
	user: {
		addQrcode:{
			url: `${config.MOCK_URL}/user/addQrcode`,
			name: "添加用户二维码",
			get: async function(data){
				return await http.get(this.url,data);
			}
		},
		vipcard:{
			url: `${config.MOCK_URL}/vipcard/list`,
			name: "会员套餐",
			get: async function(data){
				return await http.get(this.url,data);
			}
		},
		sendvideo:{
            url: `${config.MOCK_URL}/user/sendvideo`,
            name: "发送",
            get: async function(data){
                return await http.get(this.url,data);
            }
		},
		getVipCardList:{
			url: `${config.MOCK_URL}/vip/VipCard`,
			name: "会员套餐",
			get: async function(data){
				return await http.get(this.url,data);
			}
		},
		vipcard_save:{
			url: `${config.MOCK_URL}/vipcard/edit`,
			name: "会员套餐save",
			post: async function(data){
				return await http.post(this.url,data);
			}
		},
		vipcard_del:{
			url: `${config.MOCK_URL}/vipcard/del`,
			name: "会员套餐删除",
			post: async function(data){
				return await http.post(this.url,data);
			}
		},
		vip:{
			url: `${config.MOCK_URL}/vip`,
			name: "会员列表",
			get: async function(data){
				return await http.get(this.url,data);
			}
		},
		vip_shenghe:{
			url: `${config.MOCK_URL}/vip/shenghe`,
			name: "会员列表",
			post: async function(data){
				return await http.post(this.url,data);
			}
		},
		vip_del: {
			url: `${config.MOCK_URL}/vip/del`,
			name: "删除会员",
			post: async function(params={}){
				return await http.get(this.url, params);
			}
		},
		login: {
			url: `${config.MOCK_URL}/login`,
			name: "登录获取用户菜单和权限,全部权限",
			post: async function(data){
				return await http.post(this.url,data);
			}
		},
		login_demo: {
			url: `${config.MOCK_URL}/login_user`,
			name: "登录获取用户菜单和权限，部分权限",
			get: async function(){
				return await http.get(this.url);
			}
		},
		list: {
			url: `${config.MOCK_URL}/user/list`,
			name: "获取用户列表",
			get: async function(params={}){
				return await http.get(this.url, params);
			}
		},
		save: {
			url: `${config.MOCK_URL}/post`,
			name: "新增编辑用户",
			post: async function(params={}){
				return await http.get(this.url, params);
			}
		},
		del: {
			url: `${config.MOCK_URL}/user/del`,
			name: "删除用户",
			post: async function(params={}){
				return await http.get(this.url, params);
			}
		},
		agent: {
			url: `${config.MOCK_URL}/agent`,
			name: "代理商列表",
			get: async function (params = {}) {
				return await http.get(this.url, params);
			}
		},
		agent_shenghe:{
			url: `${config.MOCK_URL}/agent/edit`,
			name: "代理审核",
			post: async function(data){
				return await http.post(this.url,data);
			}
		},
		agent_del:{
			url: `${config.MOCK_URL}/agent/del`,
			name: "删除代理",
			post: async function(params={}){
				return await http.post(this.url, params);
			}
		},
		seach:{
			url: `${config.MOCK_URL}/user/seach`,
			name: "用户查询",
			get: async function(params={}){
				return await http.get(this.url, params);
			}
		}
	},
	vip:{
		selectAgent:{
			url: `${config.MOCK_URL}/vip/selectAgent`,
			name: "搜索代理商",
			get: async function(data){
				return await http.get(this.url,data);
			}
		},
		save:{
			url: `${config.MOCK_URL}/vip/save`,
			name: "添加/编辑会员",
			post: async function(data){
				return await http.post(this.url,data);
			}
		}
	},
	agent: {
		list:{
			url: `${config.MOCK_URL}/agent`,
			name: "代理商数据",
			get: async function(data){
				return await http.get(this.url,data);
			}
		},
		save:{
			url: `${config.MOCK_URL}/agent/edit`,
			name: "添加/编辑代理商",
			post: async function(data){
				return await http.post(this.url,data);
			}
		}
	},
	role: {
		select: {
			url: `${config.MOCK_URL}/role`,
			name: "角色选择列表",
			get: async function(){
				return await http.get(this.url);
			}
		},
		list: {
			url: `${config.MOCK_URL}/role`,
			name: "角色列表",
			get: async function(){
				return await http.get(this.url);
			}
		}
	},
	dic: {
		list: {
			url: `${config.MOCK_URL}/dic_list`,
			name: "字典列表",
			get: async function(){
				return await http.get(this.url);
			}
		},
		info: {
			url: `${config.MOCK_URL}/dic_info`,
			name: "字典明细",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},
	app: {
		list: {
			url: `${config.MOCK_URL}/app`,
			name: "应用列表",
			get: async function(){
				return await http.get(this.url);
			}
		}
	},
	menu: {
		list: {
			url: `${config.MOCK_URL}/menu`,
			name: "菜单管理",
			get: async function(){
				// 这里接口对象偷懒重复了登录接口
				var res = await http.get(this.url);
					// res.data = res.data.menuList;
				return res;
			}
		},
		save: {
			url: `${config.MOCK_URL}/menu/edit`,
			name: "菜单编辑",
			post: async function(params){
				// 这里接口对象偷懒重复了登录接口
				return await http.post(this.url,params);

			}
		}
	},
	log: {
		list: {
			url: `${config.MOCK_URL}/loglist`,
			name: "日志列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},
	demo: {
		page: {
			url: `${config.MOCK_URL}/page`,
			name: "分页列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		upload: {
			url: `${config.MOCK_URL}/upload`,
			name: "文件上传接口",
			post: async function(data){
				return await http.post(this.url, data);
			}
		},
		select: {
			url: `${config.API_URL}/json/select.json`,
			name: "下拉菜单数据",
			get: async function(data){
				return await http.get(this.url, data);
			}
		},
		demolist: {
			list: {
				url: `${config.API_URL}/json/list.json`,
				name: "列表数据",
				get: async function(data){
					return await http.get(this.url, data);
				}
			}
		}
	},
	system:{
		getdata: {
			url: `${config.MOCK_URL}/system/data`,
			name: "系统配置",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		key:{
			url: `${config.MOCK_URL}/system/key`,
			name: "根据key获取value",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		keyedit: {
			url: `${config.MOCK_URL}/system/keyedit`,
			name: "对应key编辑",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		edit: {
			url: `${config.MOCK_URL}/system/edit`,
			name: "编辑",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		del: {
			url: `${config.MOCK_URL}/system/del`,
			name: "删除",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		info:{
			url: `${config.MOCK_URL}/system/info`,
			name: "系统信息",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		tongji:{
			url: `${config.MOCK_URL}/system/tj`,
			name: "数据统计",
			get: async function(data){
				return await http.get(this.url, data);
			}
		}
	},
	xiazai:{
		image:{
			url: `${config.MOCK_URL}/system/info`,
			name: "系统信息",
			get: async function(params){
				return await http.xz(params.url);
			}
		}
	}

}

export default api;
